/*
 * $Id: RequestDefn2SweepFileInfoDAO.java,v 1.3 2009/07/10 15:18:35 navdeep_mahajan Exp $
 * 
 * Copyright (C) 2006 General Electric Company. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 * 
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */
package com.ge.healthcare.autosc.common.database.dao;

import java.util.ArrayList;
import java.util.List;

import org.springmodules.cache.annotations.Cacheable;

import com.ge.healthcare.autosc.common.ASCUtil;
import com.ge.healthcare.autosc.common.database.pojo.CfgRequestDefnToSweepFi;
import com.ge.healthcare.autosc.common.database.pojo.CfgSweepFileInfo;

/**
 * @author 212042764
 * 
 */
public class RequestDefn2SweepFileInfoDAO extends BaseDAO implements
		ISweepFileInfoDAO {
	/**
	 * Eclispe generated
	 */
	private static final long serialVersionUID = -7226357476355839773L;
	private static final String TABLE_NAME = "com.ge.healthcare.autosc.common.database.pojo.CfgRequestDefnToSweepFi";
	private static final String COL_REQUEST_DEFN_ID = "id.requestDefnId";
	private static final String COL_TRANSFER_ORDER = "id.cfgSweepFileInfo.transferOrder";

	public RequestDefn2SweepFileInfoDAO() {
		super(TABLE_NAME);
	}

	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.ISweepFileInfoDAO#getSweepFileInfoForRequestDefn(java.lang.Long)
	 */
	@Cacheable(modelId = "RequestDefn2SweepFiDAOCacheModel")
	public List<CfgSweepFileInfo> getSweepFileInfoForRequestDefn(
			Long requestDefnId) {
		List<?> rtvdSweepFileInfoLst = this.findByProperty(COL_REQUEST_DEFN_ID,
				requestDefnId, COL_TRANSFER_ORDER);
		if (ASCUtil.isNullOrEmptyList(rtvdSweepFileInfoLst)) {
			return null;
		}
		List<CfgSweepFileInfo> sweepFileInfoLst = new ArrayList<CfgSweepFileInfo>();
		for (int iCount = 0; iCount < rtvdSweepFileInfoLst.size(); iCount++) {
			sweepFileInfoLst
					.add(((CfgRequestDefnToSweepFi) rtvdSweepFileInfoLst
							.get(iCount)).getId().getCfgSweepFileInfo());
		}
		return sweepFileInfoLst;
	}

	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.BaseDAO#save(java.lang.Object)
	 */
	public void save(Object pojo) {
		super.save(pojo);
	}

	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.IRequestTypeDAO#saveAlways(java.lang.Object)
	 */
	public void saveAlways(Object pojo) {
		super.save(pojo);
	}

	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.BaseDAO#deleteByID(java.lang.Object)
	 */
	public void deleteByID(Object pojo) {
		super.deleteByID(pojo);
	}

	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.BaseDAO#refresh(java.lang.Object)
	 */
	public void refresh(Object pojo) {
		super.refresh(pojo);
	}
}
